// components/search/search.js
Component({
  properties: {
    placeholder: {
      type: String,
      value: '搜索...'
    },
    focus: {
      type: Boolean,
      value: false
    },
    rselect: {
      type: Boolean,
      value: false
    },
  },
  data: {
    range: [
      { name: '全部状态', value: 0 },
      { name: '未下单', value: 0 },
      { name: '待审核', value: 0 },
      { name: '审核未通过', value: 0 },
      { name: '进行中', value: 0 },
      { name: '待上画验收', value: 0 },
      { name: '待下画验收', value: 0 }
    ],
    rangeKey: 'name',
    activeIndex: 0
  },
  methods: {
    handleInput(e) {
      // console.log('handleInput', e)
      this.triggerEvent('inputEvent', e);
    },
    handleChange(e) {
      // console.log('handleChange', e)
      this.triggerEvent('changeEvent', e);
    },
    handleConfirm(e) {
      // console.log('handleConfirm', e);
      this.triggerEvent('confirmEvent', e);
    },
    handleSelectChange(e) {
      const { activeIndex, range, rangeKey } = this.data
      this.setData({ activeIndex: e.detail.value })
      this.triggerEvent('selectEvent', range[activeIndex][rangeKey]);
    }
  }
})
